Xbasic

SQL::TableInfoAddColumn Method

Syntax

Column_Number as N = <SQL::TableInfo>.AddColumn(Column as SQL::DataTypeInfo)

Arguments

Column_Number

The column number of the new column.

<SQL::TableInfo>

A SQL::TableInfo object.

Column

A SQL::DataTypeInfo object.

Description

Add a Column.

Discussion

The AddColumn() method adds a new column definition to a table definition.

Example

dim conn as SQL::Connection
dim ti as SQL::TableInfo
dim dti as SQL::DataTypeInfo
connString = "{A5API='Access', FileName='c:\program files\a5v8\mdbfiles\alphasports.mdb'}"
if .not. conn.open(connString)
   ui_msg_box("Error", conn.CallResult.text)
   end
end if
if conn.GetTableInfo(ti, "customer") then
   ui_msg_box("Error", conn.CallResult.text)
   conn.close()
   end
end if
ui_msg_box("Table Definition", ti.xml)

The .Name property of the SQL::DataTypeInfo object is required before calling the AddColumn() method.

dti.Name = "Fullname"
dti.AlphaType = "Character"
if ti.AddColumn(dti) > 0 then
    ui_msg_box("New Table Definition", ti.xml)
end if
conn.close()

See Also